package com.lanou.shunke.article.service.impl;

import com.lanou.shunke.article.entity.Article;
import com.lanou.shunke.article.service.ArticleService;
import com.lanou.shunke.common.entity.ShunkeResult;
import com.lanou.shunke.common.utils.JsoupUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleServiceImpl implements ArticleService {

    @Value("${articleBaseUrl}")
    private String articleBaseUrl;

    @Override
    public List<Article> findAll() {
        String url = articleBaseUrl + "/article/byType?type=1";
        ShunkeResult data = JsoupUtils.getData(url);
        return (List<Article>) data.getData();
    }
}
